# Android
AndroidApp = {"cloudsmart": {"appPackage": 'com.visualworld.cloudsmart',
                             "appActivity": 'com.qihoo.main.activity.SHSplashActivity'},
              # Android-智慧生活
              "smart": {"appPackage": "com.qihoo.smart",
                        "appActivity": "com.qihoo.main.activity.SHSplashActivity"},
              # Android-360云智连
              "ecology": {"appPackage": "com.visualworld.ecology",
                        "appActivity": ""},
              }


class PhoneBy(object):
    """
    ios 定位：          id  text   className    label  labelContains  xpath
    单个元素有timeout get()
    s(text='Dashboard').find_elements() 没找到就会返回为[]

    android 定位  resourceId text  className    description descriptionContains xpath (u2不建议使用，速度不快)
    默认返回所有的元素

    """
    AccessibilityId = "accessibility_id"
    ID = "id"
    XPATH = "xpath"  # ios 用 classChain 来定位。Predicate 和 Xpath 定位的结合
    CLASS_NAME = "class name"
    COMPOSE_CLASS_NAME_WITH_TEXT = "class_name with text"  # 组合定位 ios对应label 安卓对应text
    COMPOSE_CLASS_NAME_WITH_VALUE = "class_name with value"  # 组合定位


class GlobalVar:
    """
    用于保存全局变量
    """
    DEVICE_SN = ""
    BUNDLE_ID = ""
    TASK_ID = ""
    TEST_SYSTEM = ""
    IOS = "ios"
    ANDROID = "android"
    DEVICE_CARD_LAYOUT = 0
    LOGIN = False
    LOGIN_PHONE = "13011068815"
    LOGIN_PWD = "ljf123321"
    PICTURE_PATH = None
    PICTURE_NUM = 0

    @staticmethod
    def set_device_sn(device_sn):
        GlobalVar.DEVICE_SN = device_sn

    @staticmethod
    def get_device_sn():
        return GlobalVar.DEVICE_SN

    @staticmethod
    def set_test_platform(test_platform):
        GlobalVar.TEST_PLATFORM = test_platform

    @staticmethod
    def set_bundle_id(bundle_id):
        GlobalVar.BUNDLE_ID = bundle_id

    @staticmethod
    def get_bundle_id():
        return GlobalVar.BUNDLE_ID

    @staticmethod
    def picture_number(pic_num):
        GlobalVar.PICTURE_NUM = pic_num